<?php
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\Admin;
use App\Http\Controllers\Api;
use App\Http\Controllers\Admin\Hotel;
use App\Http\Controllers\Admin\Office;

// 上传
Route::namespace('Api')->as('上传 - ')->middleware(['admin.log', 'admin.login'])->prefix('admin')->group(function () {
   Route::post('upImage', [Api\UploadController::class, 'uploadImage'])->name('图片');

   Route::post('upFile', [Api\UploadController::class, 'uploadFile'])->name('文件');

   Route::post('upVideo', [Api\UploadController::class, 'uploadVideo'])->name('视频');

   Route::post('upVod', [Api\UploadController::class, 'uploadVod'])->name('分片');
});

Route::namespace('Admin')->middleware(['admin.log'])->as('管理平台 - ')->prefix('admin')->group(function () {
    // 基础
    Route::get('/', [Admin\LoginController::class, 'index'])->name('登录 - 主页');

    Route::post('/login', [Admin\LoginController::class, 'login'])->name('登录');

    Route::middleware(['admin.login'])->group(function () {

        Route::get('/index', [Admin\IndexController::class, 'index'])->name('主页');

        Route::get('/configs', [Admin\IndexController::class, 'configs'])->name('配置');

        Route::get('/menus', [Admin\IndexController::class, 'menus'])->name('菜单');

        // 公共

        // 各菜单功能
        Route::as('账号管理 - ')->prefix('account')->group(function () {
            Route::get('index', [Admin\AccountController::class, 'index'])->name('主页');

            Route::any('list', [Admin\AccountController::class, 'dataList'])->name('查询');

            Route::get('editAdd', [Admin\AccountController::class, 'editAdd'])->name('表单');

            Route::post('create', [Admin\AccountController::class, 'dataSave'])->name('新增');

            Route::post('update', [Admin\AccountController::class, 'dataSave'])->name('更新');

            Route::post('deletes', [Admin\AccountController::class, 'deletes'])->name('删除');

            Route::post('enables', [Admin\AccountController::class, 'enables'])->name('启用');

            Route::post('disables', [Admin\AccountController::class, 'disables'])->name('禁用');
        });

        Route::as('角色管理 - ')->prefix('role')->group(function () {
            Route::get('index', [Admin\RoleController::class, 'index'])->name('主页');

            Route::any('list', [Admin\RoleController::class, 'dataList'])->name('查询');

            Route::get('editAdd', [Admin\RoleController::class, 'editAdd'])->name('表单');

            Route::post('save', [Admin\RoleController::class, 'dataSave'])->name('存储');

            Route::post('create', [Admin\RoleController::class, 'dataSave'])->name('创建');

            Route::post('update', [Admin\RoleController::class, 'dataSave'])->name('更新');

            Route::post('deletes', [Admin\RoleController::class, 'deletes'])->name('删除');
        });

        Route::as('资源管理 - ')->prefix('menu')->group(function () {
            Route::get('index', [Admin\AdminMenuController::class, 'index'])->name('主页');

            Route::get('list', [Admin\AdminMenuController::class, 'dataList'])->name('查询');

            Route::get('editAdd', [Admin\AdminMenuController::class, 'editAdd'])->name('表单');

            Route::post('create', [Admin\AdminMenuController::class, 'dataSave'])->name('创建');

            Route::post('update', [Admin\AdminMenuController::class, 'dataSave'])->name('更新');

            Route::post('deletes', [Admin\AdminMenuController::class, 'deletes'])->name('删除');
        });

        Route::as('酒店管理 - ')->prefix('hotel')->group(function () {
           Route::get('index', [Hotel\HotelController::class, 'index'])->name('主页');

           Route::get('list', [Hotel\HotelController::class, 'dataList'])->name('查询');

           Route::get('editAdd', [Hotel\HotelController::class, 'editAdd'])->name('表单');

           Route::post('create', [Hotel\HotelController::class, 'dataSave'])->name('创建');

           Route::post('update', [Hotel\HotelController::class, 'dataSave'])->name('更新');

           Route::post('deletes', [Hotel\HotelController::class, 'deletes'])->name('删除');

           Route::as('相册管理 - ')->prefix('image')->group(function () {

               Route::get('index', [Hotel\HotelImageController::class, 'index'])->name('主页');

               Route::get('list', [Hotel\HotelImageController::class, 'dataList'])->name('查询');

               Route::get('editAdd', [Hotel\HotelImageController::class, 'editAdd'])->name('表单');

               Route::post('create', [Hotel\HotelImageController::class, 'dataSave'])->name('创建');

               Route::post('update', [Hotel\HotelImageController::class, 'dataSave'])->name('更新');

               Route::post('deletes', [Hotel\HotelImageController::class, 'deletes'])->name('删除');
           });

        });

        Route::as('标签管理 - ')->prefix('label')->group(function () {

           Route::get('index/{list_type}', [Admin\LabelController::class, 'index'])->name('主页');

            Route::get('index/1', [Admin\LabelController::class, 'index'])->name('酒店设施 - 主页');

            Route::get('index/2', [Admin\LabelController::class, 'index'])->name('酒店相册 - 主页');

            Route::get('list', [Admin\LabelController::class, 'dataList'])->name('查询');

            Route::get('editAdd', [Admin\LabelController::class, 'editAdd'])->name('表单');

            Route::post('create', [Admin\LabelController::class, 'dataSave'])->name('创建');

            Route::post('update', [Admin\LabelController::class, 'dataSave'])->name('更新');

            Route::post('deletes', [Admin\LabelController::class, 'deletes'])->name('删除');
        });

        Route::as('套餐管理 - ')->prefix('product')->group(function () {

           Route::get('index/{list_type}', [Admin\ProductController::class, 'index'])->name('主页');

           Route::get('index/1', [Admin\ProductController::class, 'index'])->name('酒店套餐 - 主页');

           Route::get('list', [Admin\ProductController::class, 'dataList'])->name('查询');

           Route::get('editAdd', [Admin\ProductController::class, 'editAdd'])->name('表单');

           Route::post('create', [Admin\ProductController::class, 'dataSave'])->name('创建');

           Route::post('update', [Admin\ProductController::class, 'dataSave'])->name('更新');

           Route::post('deletes', [Admin\ProductController::class, 'deletes'])->name('删除');

           Route::post('enables', [Admin\ProductController::class, 'enables'])->name('上架');

           Route::post('disables', [Admin\ProductController::class, 'disables'])->name('下架');
        });

        Route::as('办公管理 - ')->prefix('office')->group(function () {

            Route::get('index', [Office\OfficeController::class, 'index'])->name('主页');

            Route::get('list', [Office\OfficeController::class, 'dataList'])->name('查询');

            Route::get('editAdd', [Office\OfficeController::class, 'editAdd'])->name('表单');

            Route::post('create', [Office\OfficeController::class, 'dataSave'])->name('创建');

            Route::post('update', [Office\OfficeController::class, 'dataSave'])->name('更新');

            Route::post('deletes', [Office\OfficeController::class, 'deletes'])->name('删除');
        });
    });
});

